.\" -*- nroff -*-
.\" Copyright 2013 Los Alamos National Security, LLC. All rights reserved.
.\" Copyright 2010 Cisco Systems, Inc.  All rights reserved.
.\" Copyright 2006-2008 Sun Microsystems, Inc.
.\" Copyright (c) 1996 Thinking Machines Corporation
.\" $COPYRIGHT$
.TH MPI_Dist_graph_neighbors 3 "#OMPI_DATE#" "#PACKAGE_VERSION#" "#PACKAGE_NAME#"
.SH NAME
\fBMPI_Dist_graph_neighbors \fP \- Returns the neighbors of the calling process in a distributed graph topology.

.SH SYNTAX
.ft R
.SH C Syntax
.nf
#include <mpi.h>
int MPI_Dist_graph_neighbors(MPI_Comm \fIcomm\fP, int \fImaxindegree\fP, int \fIsources\fP[], int \fIsourceweights\fP[],
                             int \fImaxoutdegree\fP, int \fIdestinations\fP[], int \fIdestweights\fP[])

.fi
.SH Fortran Syntax
.nf
USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_DIST_GRAPH_NEIGHBORS(COMM, MAXINDEGREE, SOURCES, SOURCEWEIGHTS,
        MAXOUTDEGREE, DESTINATIONS, DESTWEIGHTS, IERROR)
        INTEGER COMM, MAXINDEGREE, SOURCES(*), SOURCEWEIGHTS(*), MAXOUTDEGREE,
                DESTINATIONS(*), DESTWEIGHTS(*), IERROR

.fi
.SH Fortran 2008 Syntax
.nf
USE mpi_f08
MPI_Dist_Graph_neighbors(\fIcomm\fP, \fImaxindegree\fP, \fIsources\fP, \fIsourceweights\fP,
		\fImaxoutdegree\fP, \fIdestinations\fP, \fIdestweights\fP, \fIierror\fP)
	TYPE(MPI_Comm), INTENT(IN) :: \fIcomm\fP
	INTEGER, INTENT(IN) :: \fImaxindegree\fP, \fImaxoutdegree\fP
	INTEGER, INTENT(OUT) :: \fIsources(maxindegree)\fP, \fIdestinations(maxoutdegree)\fP
	INTEGER :: sourceweights(*), destweights(*)
	INTEGER, OPTIONAL, INTENT(OUT) :: \fIierror\fP

.fi
.SH INPUT PARAMETERS
.ft R
.TP 1i
comm
Communicator with distributed graph topology (handle).
.TP 1i
maxindegree
Size of \fIsources\fP and \fIsourceweights\fP arrays (non-negative integer).
.TP 1i
maxoutdegree
Size of \fIdestinations\fP and \fIdestweights\fP arrays (non-negative integer).

.SH OUTPUT PARAMETERS
.ft R
.TP 1i
sources
Processes for which the calling process is a destination (array of non-negative integers).
.TP 1i
sourceweights
Weights of the edges into the calling process (array of non-negative integers).
.TP 1i
destinations
Processes for which the calling process is a source (array of non-negative integers).
.TP 1i
destweights
Weights of the edges out of the calling process (array of non-negative integers).
.ft R
.TP 1i
IERROR
Fortran only: Error status (integer).

.SH DESCRIPTION
.ft R
MPI_Dist_graph_neighbors returns the source and destination ranks in a distributed graph topology
for the calling process. This call will return up to \fImaxindegree\fP source ranks in the \fIsources\fP array
and up to \fImaxoutdegree\fP destination ranks in the \fIdestinations\fP array. If weights were
specified at the time of the communicator's creation then the associated weights
are returned in the \fIsourceweights\fP and \fI destweights\fP arrays. If the communicator
was created with MPI_Dist_graph_create_adjacent then the order of the values in \fIsources\fP and
\fIdestinations\fP is identical to the input that was used by the process with the same rank in
comm_old in the creation call.

.fi
.SH ERRORS
Almost all MPI routines return an error value; C routines as the value of the function and Fortran routines in the last argument.
.sp
Before the error value is returned, the current MPI error handler is
called. By default, this error handler aborts the MPI job, except for I/O function errors. The error handler may be changed with MPI_Comm_set_errhandler; the predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned. Note that MPI does not guarantee that an MPI program can continue past an error.

.SH SEE ALSO
.ft R
.sp
MPI_Dist_graph_neighbors_count

